# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1019.1.21 -> 1.1019.1.22
#	drivers/char/serial.c	1.38    -> 1.39   
#	Documentation/Configure.help	1.166.1.3 -> 1.166.1.4
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/07/29	bjorn.helgaas@hp.com	1.1019.1.22
# SERIAL: add documentation and error checking for serial port discovery via ACPI.
# --------------------------------------------
#
diff -Nru a/Documentation/Configure.help b/Documentation/Configure.help
--- a/Documentation/Configure.help	Wed Oct  8 09:05:54 2003
+++ b/Documentation/Configure.help	Wed Oct  8 09:05:54 2003
@@ -17519,6 +17519,11 @@
   purpose port, say Y here. See
   <http://www.dig64.org/specifications/DIG64_HCDPv10a_01.pdf>.
 
+Support for serial ports defined in ACPI namespace
+CONFIG_SERIAL_ACPI
+  If you wish to enable serial port discovery via the ACPI
+  namespace, say Y here.  If unsure, say N.
+
 Support for PowerMac serial ports
 CONFIG_MAC_SERIAL
   If you have Macintosh style serial ports (8 pin mini-DIN), say Y
diff -Nru a/drivers/char/serial.c b/drivers/char/serial.c
--- a/drivers/char/serial.c	Wed Oct  8 09:05:54 2003
+++ b/drivers/char/serial.c	Wed Oct  8 09:05:54 2003
@@ -4674,6 +4674,12 @@
 	if (ACPI_SUCCESS(status)) {
 		serial_req->iomem_base = ioremap(addr.min_address_range,
 			addr.max_address_range - addr.min_address_range + 1);
+		if (!serial_req->iomem_base) {
+			printk("%s: couldn't ioremap 0x%lx-0x%lx\n", 
+				__FUNCTION__, addr.min_address_range,
+				addr.max_address_range);
+			return AE_ERROR;
+		}
 		serial_req->io_type = SERIAL_IO_MEM;
 		serial_req->port = 0;
 		serial_req->port_high = 0;
@@ -4691,12 +4697,21 @@
 static int acpi_serial_add(struct acpi_device *device)
 {
 	struct serial_struct serial_req;
+	acpi_status status;
 	int line;
 
 	memset(&serial_req, 0, sizeof(serial_req));
 
-	acpi_walk_resources(device->handle, METHOD_NAME__CRS,
+	status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
 		acpi_serial_resource, &serial_req);
+	if (ACPI_FAILURE(status))
+		return -ENODEV;
+
+	if (!serial_req.iomem_base) {
+		printk("%s: no iomem address in %s _CRS\n", __FUNCTION__,
+			device->pnp.bus_id);
+		return -ENODEV;
+	}
 
 	serial_req.baud_base = BASE_BAUD;
 	serial_req.flags = ASYNC_SKIP_TEST|ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ;